<HTML>
<HEAD>
<TITLE>/usr/local/src/sqlrelay-0.25/doc/api/python/test.py.html</TITLE>
</HEAD>
<BODY BGcolor=#FFFFFF TEXT=#000000>
<PRE>
<FONT color=#0000f8># Copyright (c) 2000 Roman Milner</FONT>
<FONT color=#0000f8># See the file COPYING for more information</FONT>

<FONT color=#a020f0>from</FONT> SQLRelay <FONT color=#a020f0>import</FONT> CSQLRelay

<B><FONT color=#a02828>class</FONT></B> <FONT color=#008888>sqlrconnection</FONT>:

    &quot;&quot;&quot;
<FONT color=#f800f8>    A wrapper for the sqlrelay connection API.  Closely follows the C++ API.</FONT>
<FONT color=#f800f8>    </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>__init__</FONT>(self, host, port, socket, user, password, retrytime=0, tries=1):
        &quot;&quot;&quot;<FONT color=#f800f8> </FONT>
<FONT color=#f800f8>        Opens a connection to the sqlrelay server and authenticates with</FONT>
<FONT color=#f800f8>        user and password.  Failed connections are retried for tries times</FONT>
<FONT color=#f800f8>        at retrytime interval.  If tries is 0 then retries will continue</FONT>
<FONT color=#f800f8>        forever.  If retrytime is 0 then retries will be attempted on a</FONT>
<FONT color=#f800f8>        default interval.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;
        
    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>endSession</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Ends the current session.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>suspendSession</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Disconnects this connection from the current</FONT>
<FONT color=#f800f8>        session but leaves the session open so </FONT>
<FONT color=#f800f8>        that another connection can connect to it </FONT>
<FONT color=#f800f8>        using resumeSession().</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getConnectionPort</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the inet port that the connection is </FONT>
<FONT color=#f800f8>        communicating over. This parameter may be </FONT>
<FONT color=#f800f8>        passed to another connection for use in</FONT>
<FONT color=#f800f8>        the resumeSession() method.</FONT>
<FONT color=#f800f8>        Note: the value returned by this method is</FONT>
<FONT color=#f800f8>        only valid after a call to suspendSession().</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getConnectionSocket</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the unix socket that the connection is </FONT>
<FONT color=#f800f8>        communicating over. This parameter may be </FONT>
<FONT color=#f800f8>        passed to another connection for use in</FONT>
<FONT color=#f800f8>        the resumeSession() method.</FONT>
<FONT color=#f800f8>        Note: the value returned by this method is</FONT>
<FONT color=#f800f8>        only valid after a call to suspendSession().</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>resumeSession</FONT>(self, port, socket):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Resumes a session previously left open </FONT>
<FONT color=#f800f8>        using suspendSession().</FONT>
<FONT color=#f800f8>        Returns 1 on success and 0 on failure.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>ping</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns 1 if the database is up and 0</FONT>
<FONT color=#f800f8>        if it's down.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>identify</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the type of database: </FONT>
<FONT color=#f800f8>          oracle8, postgresql, mysql, etc.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>dbVersion</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the version of the database</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>serverVersion</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the version of the SQL Relay server software</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>clientVersion</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the version of the SQL Relay client software</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>bindFormat</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns a string representing the format</FONT>
<FONT color=#f800f8>        of the bind variables used in the db.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a62828>def</FONT></B> <FONT color=#008a8e>autoCommitOn</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#ff00ff>        Instructs the database to perform a commit</FONT>
<FONT color=#ff00ff>        after every successful query.</FONT>
<FONT color=#ff00ff>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a62828>def</FONT></B> <FONT color=#008a8e>autoCommitOff</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#ff00ff>        Instructs the database to wait for the </FONT>
<FONT color=#ff00ff>        client to tell it when to commit.</FONT>
<FONT color=#ff00ff>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>commit</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Issues a commit.  Returns a 1 if the commit succeeded,</FONT>
<FONT color=#f800f8>        0 if it failed and -1 if an error occurred.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>rollback</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Issues a rollback.  Returns a 1 if the rollback succeeded,</FONT>
<FONT color=#f800f8>        0 if it failed and -1 if an error occurred.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>debugOn</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Turn verbose debugging on.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>debugOff</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Turn verbose debugging off.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getDebug</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns 1 if debugging is turned on and 0 if debugging is turned off.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;




<B><FONT color=#a02828>class</FONT></B> <FONT color=#008888>sqlrcursor</FONT>:


    &quot;&quot;&quot;
<FONT color=#f800f8>    A wrapper for the sqlrelay cursor API.  Closely follows the C++ API.</FONT>
<FONT color=#f800f8>    </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>__init__</FONT>(self, sqlrcon):
        self.cursor = CSQLRelay.sqlrcur_alloc(sqlrcon.connection)

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>__del__</FONT>(self):
        CSQLRelay.sqlrcur_free(self.cursor)

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>setResultSetBufferSize</FONT>(self, rows):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Sets the number of rows of the result set</FONT>
<FONT color=#f800f8>        to buffer at a time.  0 (the default)</FONT>
<FONT color=#f800f8>        means buffer the entire result set.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getResultSetBufferSize</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the number of result set rows that </FONT>
<FONT color=#f800f8>        will be buffered at a time or 0 for the</FONT>
<FONT color=#f800f8>        entire result set.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>dontGetColumnInfo</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Tells the server not to send any column</FONT>
<FONT color=#f800f8>        info (names, types, sizes).  If you don't</FONT>
<FONT color=#f800f8>        need that info, you should call this</FONT>
<FONT color=#f800f8>        method to improve performance.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getColumnInfo</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Tells the server to send column info.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a62828>def</FONT></B> <FONT color=#008a8e>mixedCaseColumnNames</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#ff00ff>        Columns names are returned in the same</FONT>
<FONT color=#ff00ff>        case as they are defined in the database.</FONT>
<FONT color=#ff00ff>        This is the default.</FONT>
<FONT color=#ff00ff>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a62828>def</FONT></B> <FONT color=#008a8e>upperCaseColumnNames</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#ff00ff>        Columns names are converted to upper case.</FONT>
<FONT color=#ff00ff>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a62828>def</FONT></B> <FONT color=#008a8e>lowerCaseColumnNames</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#ff00ff>        Columns names are converted to lower case.</FONT>
<FONT color=#ff00ff>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>cacheToFile</FONT>(self, filename):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Sets query caching on.  Future queries</FONT>
<FONT color=#f800f8>        will be cached to the file &quot;filename&quot;.</FONT>
<FONT color=#f800f8>        The full pathname of the file can be</FONT>
<FONT color=#f800f8>        retrieved using getCacheFileName().</FONT>
<FONT color=#f800f8>        </FONT>
<FONT color=#f800f8>        A default time-to-live of 10 minutes is</FONT>
<FONT color=#f800f8>        also set.</FONT>
<FONT color=#f800f8>        </FONT>
<FONT color=#f800f8>        Note that once cacheToFile() is called,</FONT>
<FONT color=#f800f8>        the result sets of all future queries will</FONT>
<FONT color=#f800f8>        be cached to that file until another call </FONT>
<FONT color=#f800f8>        to cacheToFile() changes which file to</FONT>
<FONT color=#f800f8>        cache to or a call to cacheOff() turns off</FONT>
<FONT color=#f800f8>        caching.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>setCacheTtl</FONT>(self, ttl):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Sets the time-to-live for cached result</FONT>
<FONT color=#f800f8>        sets. The sqlr-cachemanger will remove each </FONT>
<FONT color=#f800f8>        cached result set &quot;ttl&quot; seconds after it's </FONT>
<FONT color=#f800f8>        created.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getCacheFileName</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the name of the file containing the most</FONT>
<FONT color=#f800f8>        recently cached result set.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>cacheOff</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Sets query caching off.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;


    &quot;&quot;&quot;
<FONT color=#f800f8>    If you don't need to use substitution or bind variables</FONT>
<FONT color=#f800f8>    in your queries, use these two methods.</FONT>
<FONT color=#f800f8>    </FONT>&quot;&quot;&quot;
    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>sendQuery</FONT>(self, query):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Send a SQL query to the server and</FONT>
<FONT color=#f800f8>        gets a result set.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a62828>def</FONT></B> <FONT color=#008a8e>sendQueryWithLength</FONT>(self, query, length):
        &quot;&quot;&quot;
<FONT color=#ff00ff>        Sends &quot;query&quot; with length &quot;length&quot; and gets</FONT>
<FONT color=#ff00ff>        a result set. This method must be used if</FONT>
<FONT color=#ff00ff>        the query contains binary data.</FONT>
<FONT color=#ff00ff>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>sendFileQuery</FONT>(self, path, file):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Send the SQL query in path/file to the server and</FONT>
<FONT color=#f800f8>        gets a result set.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    &quot;&quot;&quot;
<FONT color=#f800f8>    If you need to use substitution or bind variables, in your</FONT>
<FONT color=#f800f8>    queries use the following methods.  See the API documentation</FONT>
<FONT color=#f800f8>    for more information about substitution and bind variables.</FONT>
<FONT color=#f800f8>    </FONT>&quot;&quot;&quot;
    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>prepareQuery</FONT>(self, query):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Prepare to execute query.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a62828>def</FONT></B> <FONT color=#008a8e>prepareQueryWithLength</FONT>(self, query, length):
        &quot;&quot;&quot;
<FONT color=#ff00ff>        Prepare to execute &quot;query&quot; with length </FONT>
<FONT color=#ff00ff>        &quot;length&quot;.  This method must be used if the</FONT>
<FONT color=#ff00ff>        query contains binary data.</FONT>
<FONT color=#ff00ff>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>prepareFileQuery</FONT>(self, path, file):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Prepare to execute the contents of path/filename.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>substitution</FONT>(self, variable, value, precision=0, scale=0):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Define a substitution variable.</FONT>
<FONT color=#f800f8>        Returns true if the variable was successfully substituted or false if</FONT>
<FONT color=#f800f8>        the variable isn't a string, integer or floating point number, or if</FONT>
<FONT color=#f800f8>        precision and scale aren't provided for a floating point number.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>inputBind</FONT>(self, variable, value, precision=0, scale=0):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Define an input bind varaible.</FONT>
<FONT color=#f800f8>        Returns true if the variable was successfully bound or false if the</FONT>
<FONT color=#f800f8>        variable isn't a string, integer or floating point number, or if</FONT>
<FONT color=#f800f8>        precision and scale aren't provided for a floating point number.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>inputBindBlob</FONT>(self, variable, value, length):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Define a BLOB input bind varaible.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>inputBindClob</FONT>(self, variable, value, length):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Define a CLOB input bind varaible.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>defineOutputBindString</FONT>(self, variable, length):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Define a string output bind varaible.</FONT>
<FONT color=#f800f8>        "length" bytes will be reserved to store the value.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>defineOutputBindInteger</FONT>(self, variable):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Define an integer output bind varaible.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>defineOutputBindDouble</FONT>(self, variable):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Define a double precision floating point</FONT>
<FONT color=#f800f8>        output bind varaible.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>defineOutputBindBlob</FONT>(self, variable):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Define a BLOB output bind varaible.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>defineOutputBindClob</FONT>(self, variable):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Define a CLOB output bind varaible.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>defineOutputBindCursor</FONT>(self, variable):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Define a cursor output bind varaible.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>substitutions</FONT>(self, variables, values, precisions=None, scales=None):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Define substitution variables.</FONT>
<FONT color=#f800f8>        Returns true if the variables were successfully substituted or false if</FONT>
<FONT color=#f800f8>        one of the variables wasn't a string, integer or floating point number,</FONT>
<FONT color=#f800f8>        or if precision and scale weren't provided for a floating point number.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>inputBinds</FONT>(self, variables, values, precisions=None, scales=None):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Define input bind variables.</FONT>
<FONT color=#f800f8>        Returns true if the variables were successfully bound or false if one</FONT>
<FONT color=#f800f8>        of the variables wasn't a string, integer or floating point number,</FONT>
<FONT color=#f800f8>        or if precision and scale weren't provided for a floating point number.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;
        

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>validateBinds</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        If you are binding to any variables that </FONT>
<FONT color=#f800f8>        might not actually be in your query, call </FONT>
<FONT color=#f800f8>        this to ensure that the database won't try </FONT>
<FONT color=#f800f8>        to bind them unless they really are in the </FONT>
<FONT color=#f800f8>        query.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;
        

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>validBind</FONT>(self, variable):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns true if "variable" was a valid bind </FONT>
<FONT color=#f800f8>        variable of the query. </FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>executeQuery</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Execute the query that was previously</FONT>
<FONT color=#f800f8>        prepared and bound.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>fetchFromBindCursor</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Fetch from a cursor that was returned as</FONT>
<FONT color=#f800f8>        an output bind variable.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getOutputBindString</FONT>(self, variable):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Retrieve the value of an output bind variable.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getOutputBindBlob</FONT>(self, variable):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Retrieve the value of an output bind variable.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getOutputBindClob</FONT>(self, variable):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Retrieve the value of an output bind variable.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getOutputBindInteger</FONT>(self, variable):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Retrieve the value of an output bind variable.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getOutputBindDouble</FONT>(self, variable):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Retrieve the value of an output bind variable.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getOutputBindLength</FONT>(self, variable):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Retrieve the length of an output bind variable.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getOutputBindCursor</FONT>(self, variable):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Get the cursor associated with a previously</FONT>
<FONT color=#f800f8>        defined output bind variable.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>openCachedResultSet</FONT>(self, filename):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Open a result set after a sendCachedQeury</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>colCount</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the number of columns in the current result set.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>rowCount</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the number of rows in the current result set.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>totalRows</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the total number of rows that will </FONT>
<FONT color=#f800f8>        be returned in the result set.  Not all </FONT>
<FONT color=#f800f8>        databases support this call.  Don't use it </FONT>
<FONT color=#f800f8>        for applications which are designed to be </FONT>
<FONT color=#f800f8>        portable across databases.  -1 is returned</FONT>
<FONT color=#f800f8>        by databases which don't support this option.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>affectedRows</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the number of rows that were </FONT>
<FONT color=#f800f8>        updated, inserted or deleted by the query.</FONT>
<FONT color=#f800f8>        Not all databases support this call.  Don't </FONT>
<FONT color=#f800f8>        use it for applications which are designed </FONT>
<FONT color=#f800f8>        to be portable across databases.  -1 is </FONT>
<FONT color=#f800f8>        returned by databases which don't support </FONT>
<FONT color=#f800f8>        this option.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>firstRowIndex</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the index of the first buffered row.</FONT>
<FONT color=#f800f8>        This is useful when buffering only part of</FONT>
<FONT color=#f800f8>        the result set at a time.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>endOfResultSet</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns 0 if part of the result set is still</FONT>
<FONT color=#f800f8>        pending on the server and 1 if not.  This</FONT>
<FONT color=#f800f8>        method can only return 0 if </FONT>
<FONT color=#f800f8>        setResultSetBufferSize() has been called</FONT>
<FONT color=#f800f8>        with a parameter other than 0.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>errorMessage</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        If the query failed, the error message will be returned</FONT>
<FONT color=#f800f8>        from this method.  Otherwise, it returns None.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getNullsAsEmptyStrings</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Tells the cursor to return NULL fields and output</FONT>
<FONT color=#f800f8>        bind variables as empty strings.</FONT>
<FONT color=#f800f8>        This is the default.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getNullsAsNone</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Tells the cursor to return NULL fields and output</FONT>
<FONT color=#f800f8>        bind variables as NULL's.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getField</FONT>(self, row, col):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the value of the specified row and</FONT>
<FONT color=#f800f8>        column.  col may be a column name or number.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getFieldLength</FONT>(self, row, col):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the length of the specified row and</FONT>
<FONT color=#f800f8>        column.  col may be a column name or number.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getRow</FONT>(self, row):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns a list of values in the given row.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getRowDictionary</FONT>(self, row):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the requested row as values in a dictionary</FONT>
<FONT color=#f800f8>        with column names for keys.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getRowRange</FONT>(self, beg, end):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns a list of lists of the rows between beg and end.</FONT>
<FONT color=#f800f8>        Note: this function has no equivalent in other SQL Relay API's.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getRowLengths</FONT>(self, row):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns a list of lengths in the given row.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getRowLengthsDictionary</FONT>(self, row):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the requested row lengths as values in a dictionary</FONT>
<FONT color=#f800f8>        with column names for keys.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getRowLengthsRange</FONT>(self, beg, end):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns a list of lists of the lengths of rows between beg and end.</FONT>
<FONT color=#f800f8>        Note: this function has no equivalent in other SQL Relay API's.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getColumnName</FONT>(self, col):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the name of column number col.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getColumnNames</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns a list of column names in the current result set.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getColumnType</FONT>(self, col):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the type of the specified column.  col may</FONT>
<FONT color=#f800f8>        be a name or number.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getColumnLength</FONT>(self, col):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the length of the specified column.  col may</FONT>
<FONT color=#f800f8>        be a name or number.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getLongest</FONT>(self, col):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the length of the specified column.  col may</FONT>
<FONT color=#f800f8>        be a name or number.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>getResultSetId</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Returns the internal ID of this result set.</FONT>
<FONT color=#f800f8>        This parameter may be passed to another </FONT>
<FONT color=#f800f8>        cursor for use in the resumeResultSet() </FONT>
<FONT color=#f800f8>        method.</FONT>
<FONT color=#f800f8>        Note: the value returned by this method is</FONT>
<FONT color=#f800f8>        only valid after a call to suspendResultSet().</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>suspendResultSet</FONT>(self):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Tells the server to leave this result</FONT>
<FONT color=#f800f8>        set open when the cursor calls </FONT>
<FONT color=#f800f8>        suspendSession() so that another cursor can </FONT>
<FONT color=#f800f8>        connect to it using resumeResultSet() after </FONT>
<FONT color=#f800f8>        it calls resumeSession().</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>resumeResultSet</FONT>(self, id):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Resumes a result set previously left open </FONT>
<FONT color=#f800f8>        using suspendSession().</FONT>
<FONT color=#f800f8>        Returns 1 on success and 0 on failure.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;

    <B><FONT color=#a02828>def</FONT></B> <FONT color=#008888>resumeCachedResultSet</FONT>(self, id, filename):
        &quot;&quot;&quot;
<FONT color=#f800f8>        Resumes a result set previously left open</FONT>
<FONT color=#f800f8>        using suspendSession() and continues caching</FONT>
<FONT color=#f800f8>        the result set to &quot;filename&quot;.</FONT>
<FONT color=#f800f8>        Returns 1 on success and 0 on failure.</FONT>
<FONT color=#f800f8>        </FONT>&quot;&quot;&quot;
</PRE>
</BODY>
</HTML>
